<template>
  <el-card shadow="always" :body-style="{ padding: '20px' }">
    <!-- 分类静态结构 -->
    <el-form :inline="true">
      <el-form-item label="一级分类">
        <el-select v-model="categoryStore.c1Id" @change="c1Handler" :disabled="scene!=0">
          <el-option :key="c1.id" :label="c1.name" :value="c1.id" v-for="(c1,index) in categoryStore.c1List">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="二级分类">
        <el-select v-model="categoryStore.c2Id" @change="c2Handler" :disabled="scene!=0">
          <el-option :key="c2.id" :label="c2.name" :value="c2.id" v-for="(c2,index) in categoryStore.c2List">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="三级分类">
        <el-select v-model="categoryStore.c3Id" :disabled="scene!=0">
          <el-option :label="c3.name" :value="c3.id" v-for="(c3,index) in categoryStore.c3List" :key="c3.id">
          </el-option>
        </el-select>
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";

import useCategoryStore from '../../stores/category';
let categoryStore = useCategoryStore();

//挂载
onMounted(() => {
  categoryStore.getC1List();
});

//一级分类下拉菜单
const c1Handler = () => {
  categoryStore.getC2List();
}
//二级分类下拉菜单
const c2Handler = () => {
  categoryStore.getC3List();
}

defineProps(['scene'])

</script>

<style scoped>

</style>